package amfphp
{
	import flash.net.NetConnection;

	internal class AMFPHP extends NetConnection
	{
		private const GATEWAY :String = 'http://localhost/rssreader/dataprovider/amfphp/gateway.php';
		static private var instance :AMFPHP = new AMFPHP;
		
		public function AMFPHP()
		{
			if(instance) {
				throw new Error("Can only be accessed through AMFPHP.getInstance()"); 
			}
			
			if (GATEWAY){
				connect(GATEWAY);
			} 
			else {
				throw new Error("Gateway can not be accessed. If you work in local, check your server(W/M/Lamp or Easy Php)"); 
			}
		}
		override public function toString():String
		{
			return '[AMFPHP GATEWAY="'+GATEWAY+'"]';
		}
		
		public function set gateway (value:String):Boolean {
			
		}
		
		static public function getInstance():AMFPHP
		{
			return instance;
		}
	}
}
